﻿<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv = "X-UA-Compatible" content = "IE=EmulateIE9" /> 
	<meta name="copyright" content="All Rights Reserved, Copyright (C) 2013, Wuyeguo, Ltd." />
	<title>邯郸市公安局峰峰矿区分局-后台管理</title>
	<link rel="stylesheet" type="text/css" href="easyui/1.3.4/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="css/wu.css" />
	<link rel="stylesheet" type="text/css" href="css/icon.css" />
	<script type="text/javascript" src="./libs/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="easyui/1.3.4/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>

	<script src="./js/json2.js"></script>

	<!-- 异步上传文件插件 -->
	<script src="./js/ajaxfileupload.js"></script>

	<!-- 富文本 -->
	<!-- <link rel="stylesheet" href="./libs/kindeditor-4.1.10/themes/default/default.css" />
	<script src="./libs/kindeditor-4.1.10/kindeditor.js"></script>
	<script src="./libs/kindeditor-4.1.10/kindeditor-all.js"></script>
	<script src="./libs/kindeditor-4.1.10/kindeditor-all-min.js"></script>
	<script charset="utf-8" src="./libs/kindeditor-4.1.10/kindeditor-min.js"></script>
	<script charset="utf-8" src="./libs/kindeditor-4.1.10/lang/zh_CN.js"></script> -->

	<script src="./libs/kindeditor/kindeditor-all.js"></script>
	<script src="./libs/kindeditor/lang/zh-CN.js"></script>





	<!-- 富文本编辑器，有word粘贴图片到编辑器功能 -->


	<!-- <link type="text/css" rel="Stylesheet" href="./libs/WordPasterKindEditor4x/WordPaster/css/WordPaster.css"/>
    <link type="text/css" rel="Stylesheet" href="./libs/WordPasterKindEditor4x/WordPaster/js/skygqbox.css" />
	<link type="text/css" rel="stylesheet" href="./libs/WordPasterKindEditor4x/themes/simple/simple.css" />
	<script type="text/javascript" charset="utf-8" src="./libs/WordPasterKindEditor4x/kindeditor-min.js"></script>
	<script type="text/javascript" charset="utf-8" src="./libs/WordPasterKindEditor4x/lang/zh_CN.js"></script>
    <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/json2.min.js" charset="utf-8"></script> -->
    <!-- <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/jquery-1.4.min.js" charset="utf-8"></script> -->
	<!-- <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/w.edge.js" charset="utf-8"></script>
    <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/w.app.js" charset="utf-8"></script>
    <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/w.file.js" charset="utf-8"></script>
    <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/WordPaster.js" charset="utf-8"></script>
    <script type="text/javascript" src="./libs/WordPasterKindEditor4x/WordPaster/js/skygqbox.js" charset="utf-8"></script> -->




	<script src="./libs/jquery.cookie.js"></script>
	<script src="./libs/jquery.colorpicker.js"></script>
</head>

<body class="easyui-layout">
	<!-- begin of header -->
	<div class="wu-header" data-options="region:'north',border:false,split:true">
		<div class="wu-header-left">
			<h1>后台管理</h1>
		</div>
		<div class="wu-header-right">
			<p>
				<strong class="easyui-tooltip" title="" id="login-user-name">未知</strong>，欢迎您！</p>
			<p>
				<a href="/app/" target="_blank">网站首页&nbsp;&nbsp;&nbsp;|</a>
				<a href="#" id="uppassword" onclick="uppasswordshow()">修改密码&nbsp;&nbsp;&nbsp;|</a>
				<a href="#" onclick="logout()">安全退出</a>
			</p>
		</div>
	</div>
	<!-- end of header -->
	<!-- begin of sidebar -->
	<div class="wu-sidebar" data-options="region:'west',split:true,border:true,title:'导航菜单'">
		<div class="easyui-accordion" data-options="border:false,fit:true" id="silder-id">

			<div title="新闻管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-users">
						<a href="javascript:void(0)" data-icon="icon-users" data-link="temp/list_article.html" iframe="0">新闻管理</a>
					</li>
				</ul>
			</div>

			<div title="新闻栏目管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/column_manage.html" iframe="0">栏目管理</a>
					</li>
				</ul>
			</div>


			<div title="图片管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/photo_manage.html" iframe="0">图片管理</a>
					</li>
				</ul>
			</div>
			<div title="值班管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/duty_manage.html" iframe="0">值班管理</a>
					</li>
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/duty_table.html" iframe="0">插入值班表</a>
					</li>
				</ul>
			</div>
			<div title="通讯录管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/contacts_table.html" iframe="0">通讯录管理</a>
					</li>
				</ul>
			</div>
			<div title="导航管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/nav_manage.html" iframe="0">导航管理</a>
					</li>
				</ul>
			</div>

			<div title="部门链接" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/branch_manage.html" iframe="0">部门链接</a>
					</li>
				</ul>
			</div>
			<div title="部门管理" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/unit_manage.html" iframe="0">部门管理</a>
					</li>
				</ul>
			</div>


			<div title="超级管理员" data-options="iconCls:'icon-application-cascade'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/user_manage.html" iframe="0">管理员管理</a>
					</li>
				</ul>
			</div>

			<div title="系统设置" data-options="iconCls:'icon-wrench'" style="padding:5px;">
				<ul class="easyui-tree wu-side-tree">
					<li iconCls="icon-chart-organisation">
						<a href="javascript:void(0)" data-icon="icon-chart-organisation" data-link="temp/config_manage.html" iframe="0">全局配置</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<!-- end of sidebar -->
	<!-- begin of main -->
	<div class="wu-main" data-options="region:'center'">
		<div id="wu-tabs" class="easyui-tabs" data-options="border:false,fit:true">
			<div title="首页" data-options="href:'temp/home.html',closable:true,iconCls:'icon-tip',cls:'pd3'"></div>
		</div>
	</div>
	<!-- end of main -->
	<!-- begin of footer -->
	<div class="wu-footer" data-options="region:'south',border:true,split:true">
		&copy; 2018 POWER BY 峰峰公安
	</div>
	<!-- end of footer -->
	<script type="text/javascript">
		$(function () {
			// 检查是否登陆超时
			var user_str = $.cookie('gn_userObj');
			if (!user_str) {
				alert('登陆超时');
				window.location.href = "/app/login.html";
			}

			var user_obj = JSON.parse(user_str);

			console.log(user_obj);
			if (user_obj['isSuperAdministrator'] == 1) {

				$('#login-user-name').text(user_obj['user']);

				setTimeout(function () {
					if (user_obj['dj'] != 1) {
						$('#silder-id').accordion('remove', '超级管理员');
						$('#silder-id').accordion('remove', '系统设置');
					}
				}, 0)

			} else {

				$('#login-user-name').text(user_obj['username']);

				setTimeout(function () {
					$('#silder-id').accordion('remove', '超级管理员');
					$('#silder-id').accordion('remove', '系统设置');
					$('#silder-id').accordion('remove', '部门管理');
					$('#silder-id').accordion('remove', '部门链接');
					$('#silder-id').accordion('remove', '导航管理');
					$('#silder-id').accordion('remove', '新闻栏目管理');
					$('#silder-id').accordion('remove', '通讯录管理');
					if (user_obj['pic'] == '') {
						$('#silder-id').accordion('remove', '图片管理');

					} else if (user_obj['pic'] == null)
						$('#silder-id').accordion('remove', '图片管理');
				}, 0)

			}







			// 获取配置json内容
			$.getJSON("/config.json", function (result) {
				$.webConfig = result;
			});


			$('.wu-side-tree a').bind("click", function () {
				var title = $(this).text();
				var url = $(this).attr('data-link');
				var iconCls = $(this).attr('data-icon');
				var iframe = $(this).attr('iframe') == 1 ? true : false;
				addTab(title, url, iconCls, iframe);
			});
		})

		/**
		 * Name 载入树形菜单 
		 */
		$('#wu-side-tree').tree({
			url: 'temp/menu.php',
			cache: false,
			onClick: function (node) {
				var url = node.attributes['url'];
				if (url == null || url == "") {
					return false;
				} else {
					addTab(node.text, url, '', node.attributes['iframe']);
				}
			}
		});

		/**
		 * Name 选项卡初始化
		 */
		$('#wu-tabs').tabs({
			tools: [{
				iconCls: 'icon-reload',
				border: false,
				handler: function () {
					$('#wu-datagrid').datagrid('reload');
				}
			}]
		});

		/**
		 * Name 添加菜单选项
		 * Param title 名称
		 * Param href 链接
		 * Param iconCls 图标样式
		 * Param iframe 链接跳转方式（true为iframe，false为href）
		 */
		function addTab(title, href, iconCls, iframe) {
			var tabPanel = $('#wu-tabs');
			if (!tabPanel.tabs('exists', title)) {
				var content = '<iframe scrolling="auto" frameborder="0"  src="' + href +
					'" style="width:100%;height:100%;"></iframe>';
				if (iframe) {
					tabPanel.tabs('add', {
						title: title,
						content: content,
						iconCls: iconCls,
						fit: true,
						cls: 'pd3',
						closable: true
					});
				} else {
					tabPanel.tabs('add', {
						title: title,
						href: href,
						iconCls: iconCls,
						fit: true,
						cls: 'pd3',
						closable: true
					});
				}
			} else {
				tabPanel.tabs('select', title);
			}
		}
		/**
		 * Name 移除菜单选项
		 */
		function removeTab() {
			var tabPanel = $('#wu-tabs');
			var tab = tabPanel.tabs('getSelected');
			if (tab) {
				var index = tabPanel.tabs('getTabIndex', tab);
				tabPanel.tabs('close', index);
			}
		}

		// 登出操作
		function logout() {
			$.messager.confirm('信息提示', '确定要退出吗？', function (result) {
				if (result) {
					$.cookie('gn_userObj', null, {
						expires: -1,
						path: '/'
					});
					$.messager.alert('信息提示', '退出成功！', 'info');
					setTimeout(function () {
						window.location.href = "/app/login.html";
					}, 600);
				}
			});
		}


	</script>

	<div id="uppassword-box" class="easyui-window" title="修改密码" closed="true" style="width:300px;height:180px;">
		<form style="padding:10px 20px 10px 40px;">
			<p>新的密码:
				<input id="password1" type="password">
			</p>
			<p>确认密码:
				<input id="password2" type="password">
			</p>
			<div style="padding:5px;text-align:center;">
				<a href="#" class="easyui-linkbutton" onclick="uppassword()" icon="icon-ok">确认</a>
				<a href="#" class="easyui-linkbutton" onclick="uppasswordclose()" icon="icon-cancel">取消</a>
			</div>
		</form>
	</div>
	<script>
		var user_obj = $.parseJSON($.cookie('gn_userObj'));
		if (user_obj.isSuperAdministrator == 1) {

			$('#uppassword').hide();
		}
		uppassword
		// 显示修改密码窗口
		function uppasswordshow() {
			$('#uppassword-box').window('open');

		}
		// 修改密码
		function uppassword() {
			var newpassword1 = $('#password1').val();
			var newpassword2 = $('#password2').val();

			if (!newpassword1 && !newpassword2) {

				$.messager.alert('信息提示', '请正确输入密码', 'info');
				return;
			}

			if (newpassword1 != newpassword2) {

				$.messager.alert('信息提示', '密码不一致，请重新输入', 'info');
				return;
			}

			if ($.cookie('gn_userObj')) {
				console.log(user_obj);
				$.ajax({
					type: 'POST',
					url: $.webConfig.apiUrl + 'xsuser/updatexs',
					data: {
						id: user_obj['id'],
						username: user_obj['username'],
						password: newpassword1,
						Email: user_obj['email'],
						QQ: user_obj['qq']
					},
					cache: false,
					dataType: 'json',
					success: function (data) {
						if (data['return_code'] == 1) {
							$('#uppassword-box').window('close');
							$.messager.alert('信息提示', data['return_msg'], 'info');

						} else {
							$.messager.alert('信息提示', data['return_msg'], 'info');

						}
					},
					error: function (err) {
						alert('服务器出小差咯...');
					}
				})
			}


		}
		// 隐藏修改密码窗口
		function uppasswordclose() {

			$('#uppassword-box').window('close');
		}




	</script>

</body>

</html>